package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;

@Entity
public class Khxqinfo {
    private int khxqId;
    private String khxqzt;
    private String xqtgr;
    private Date jldate;
    private String zycd;
    private String xqnr;
    private Client kh;
    private Xsjhinfo xsjh;

    @Id
    @Column(name = "khxqId", nullable = false)
    public int getKhxqId() {
        return khxqId;
    }

    public void setKhxqId(int khxqId) {
        this.khxqId = khxqId;
    }

    @Basic
    @Column(name = "khxqzt", nullable = true, length = 20)
    public String getKhxqzt() {
        return khxqzt;
    }

    public void setKhxqzt(String khxqzt) {
        this.khxqzt = khxqzt;
    }

    @Basic
    @Column(name = "xqtgr", nullable = true, length = 6)
    public String getXqtgr() {
        return xqtgr;
    }

    public void setXqtgr(String xqtgr) {
        this.xqtgr = xqtgr;
    }

    @Basic
    @Column(name = "jldate", nullable = true)
    public Date getJldate() {
        return jldate;
    }

    public void setJldate(Date jldate) {
        this.jldate = jldate;
    }

    @Basic
    @Column(name = "zycd", nullable = true, length = 10)
    public String getZycd() {
        return zycd;
    }

    public void setZycd(String zycd) {
        this.zycd = zycd;
    }

    @Basic
    @Column(name = "xqnr", nullable = true, length = 50)
    public String getXqnr() {
        return xqnr;
    }

    public void setXqnr(String xqnr) {
        this.xqnr = xqnr;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Khxqinfo khxqinfo = (Khxqinfo) o;
        return khxqId == khxqinfo.khxqId &&
                Objects.equals(khxqzt, khxqinfo.khxqzt) &&
                Objects.equals(xqtgr, khxqinfo.xqtgr) &&
                Objects.equals(jldate, khxqinfo.jldate) &&
                Objects.equals(zycd, khxqinfo.zycd) &&
                Objects.equals(xqnr, khxqinfo.xqnr);
    }

    @Override
    public int hashCode() {
        return Objects.hash(khxqId, khxqzt, xqtgr, jldate, zycd, xqnr);
    }

    @ManyToOne
    @JoinColumn(name = "khId", referencedColumnName = "client_id")
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @OneToOne
    @JoinColumn(name = "xsjhId", referencedColumnName = "xsjhId")
    public Xsjhinfo getXsjh() {
        return xsjh;
    }

    public void setXsjh(Xsjhinfo xsjh) {
        this.xsjh = xsjh;
    }
}
